Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPBUGS-32105: Fix race to mark node Joined #823

Merged
merged 2 commits into from
May 2, 2024

Conversation

zaneb
Copy link
Member

@zaneb zaneb commented Apr 15, 2024

In the race between assisted-installer on the bootstrap node and assisted-installer-controller on the cluster control plane to mark nodes as Joined, a win for the assisted-installer-controller would cause the bootstrapping process to lock up for 30+ minutes.

Prevent this by not retrying HTTP requests that receive a 409 response at the HTTP transport level. Instead, retry at the logic level and avoid making requests that cannot succeed.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 15, 2024
@openshift-ci-robot
Copy link

@zaneb: This pull request references Jira Issue OCPBUGS-32105, which is invalid:

  • expected the bug to target the "4.16.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

In the race between assisted-installer on the bootstrap node and assisted-installer-controller on the cluster control plane to mark nodes as Joined, a win for the assisted-installer-controller would cause the bootstrapping process to lock up for 30+ minutes.

Prevent this by not retrying HTTP requests that receive a 409 response at the HTTP transport level. Instead, retry at the logic level and avoid making requests that cannot succeed.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 15, 2024
@openshift-ci openshift-ci bot requested review from danielerez and tsorya April 15, 2024 10:28
Copy link

codecov bot commented Apr 15, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 57.32%. Comparing base (236a7a0) to head (9a809af).
Report is 4 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #823      +/-   ##
==========================================
+ Coverage   54.74%   57.32%   +2.57%     
==========================================
  Files          16       16              
  Lines        3394     3803     +409     
==========================================
+ Hits         1858     2180     +322     
- Misses       1364     1416      +52     
- Partials      172      207      +35     
Files Coverage Δ
src/inventory_client/inventory_client.go 27.36% <100.00%> (+1.03%) ⬆️
src/installer/installer.go 72.58% <50.00%> (+2.83%) ⬆️

... and 2 files with indirect coverage changes

zaneb added 2 commits April 15, 2024 22:36
If a host is in the Installed state already (which can occur when the
assisted-installer-controller sets the progress to Done), don't try to
set the progress to Joined as it will not only never succeed, but also
take 30+ minutes of unlogged retries inside the client before an error
is returned.

This narrows the window in which this can occur, but if the bootstrap
assisted-installer reads the Host before the
assisted-installer-controller updates the status, this could still
occur.

Ensure any failed requests are retried by not adding the Node to the
readyMasters list until the Progress has been set to either Joined or
Done (the latter triggers a change of Status to Installed).

Improve debugging by not logging different request_ids for messages
corresponding to a single request.
Since 4xx error codes indicate a problem on the client side, most of
them cannot be usefully retried at the HTTP transport level. e.g. if a
409 Conflict is returned in response to a PUT request, then we need to
fetch the resource again with a GET before creating a new PUT request.
Blocking for 30+ minutes in the original PUT call (without logging) is
not helpful; we want the transport to return immediately so we can try
again.

Retry on only those 4xx error codes where it is conceivable that trying
the same request again might work.
@zaneb zaneb force-pushed the node-ready-race branch from 4a91060 to 9a809af Compare April 15, 2024 10:36
@zaneb
Copy link
Member Author

zaneb commented Apr 15, 2024

/cc @eranco74 @tsorya
/jira refresh

@openshift-ci openshift-ci bot requested a review from eranco74 April 15, 2024 10:38
@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 15, 2024
@openshift-ci-robot
Copy link

@zaneb: This pull request references Jira Issue OCPBUGS-32105, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.16.0) matches configured target version for branch (4.16.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

In response to this:

/cc @eranco74 @tsorya
/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@@ -776,16 +776,18 @@ func (i *installer) updateReadyMasters(nodes *v1.NodeList, readyMasters *[]strin
ctx := utils.GenerateRequestContext()
log := utils.RequestIDLogger(ctx, i.log)
log.Infof("Found a new ready master node %s with id %s", node.Name, node.Status.NodeInfo.SystemUUID)
*readyMasters = append(*readyMasters, node.Name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think better to leave it as is, in case we failed to update status but node is ready we better to exit and continue installation, no? Nothing critical in not setting Joined state it will be handle in controller afterwards

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's not as big a deal as I originally thought, because the controller will handle it anyway. But this does guarantee that everything is in the state we expect before we carry on to other work in here. It's still robust against unexpected nodes joining, and if the controller does win the race then this will still work on the next attempt.

if !ok {
return fmt.Errorf("node %s is not in inventory hosts", node.Name)
}
ctx = utils.GenerateRequestContext()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want to set request id?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already set on line 776. We don't need to generate another one, we haven't even made a request with the first one yet. And this made it really hard to debug, since the request ID that showed up in the assisted-service log never appeared in the logs here.

@zaneb
Copy link
Member Author

zaneb commented Apr 28, 2024

/retest-required

@tsorya
Copy link
Contributor

tsorya commented Apr 29, 2024

/lgtm

@tsorya
Copy link
Contributor

tsorya commented Apr 29, 2024

/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 29, 2024
Copy link

openshift-ci bot commented Apr 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tsorya, zaneb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 29, 2024
@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 27e1b0d and 2 for PR HEAD 9a809af in total

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 504ae08 and 1 for PR HEAD 9a809af in total

Copy link

openshift-ci bot commented May 2, 2024

@zaneb: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit f548d32 into openshift:master May 2, 2024
10 checks passed
@openshift-ci-robot
Copy link

@zaneb: Jira Issue OCPBUGS-32105: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-32105 has been moved to the MODIFIED state.

In response to this:

In the race between assisted-installer on the bootstrap node and assisted-installer-controller on the cluster control plane to mark nodes as Joined, a win for the assisted-installer-controller would cause the bootstrapping process to lock up for 30+ minutes.

Prevent this by not retrying HTTP requests that receive a 409 response at the HTTP transport level. Instead, retry at the logic level and avoid making requests that cannot succeed.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

This PR has been included in build ose-agent-installer-csr-approver-container-v4.16.0-202405021917.p0.gf548d32.assembly.stream.el9 for distgit ose-agent-installer-csr-approver.
All builds following this will include this PR.

@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

This PR has been included in build ose-agent-installer-orchestrator-container-v4.16.0-202405021917.p0.gf548d32.assembly.stream.el9 for distgit ose-agent-installer-orchestrator.
All builds following this will include this PR.

@openshift-merge-robot
Copy link

Fix included in accepted release 4.16.0-0.nightly-2024-05-03-091818

@zaneb
Copy link
Member Author

zaneb commented Jun 21, 2024

/cherry-pick release-4.15

@openshift-cherrypick-robot

@zaneb: new pull request created: #859

In response to this:

/cherry-pick release-4.15

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@carbonin
Copy link
Member

/cherry-pick release-ocm-2.10

@openshift-cherrypick-robot

@carbonin: new pull request created: #900

In response to this:

/cherry-pick release-ocm-2.10

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants